const log4js = require('../../../../utils/logUtils');
const logger = log4js.getLogger('sip');

const sip = require("sip");
const deviceCache = require("request/request");
const sipUtils = require("../../../../utils/sipUtils");
const clientUtils = require("../clientUtils");
const TAG = "[OK]";

module.exports={
    async handle(req){
        const {upwardUri, self_account } = clientUtils.generateClientParams();
        sip.send({
            method: 'MESSAGE',
            status: 200, reason: 'OK',
            uri: upwardUri, version: deviceCache.constants.VERSION,
            headers: {
                from: {uri: deviceCache.localUri, params: {tag:sipUtils.rstring()}},
                to: {uri: deviceCache.localUri},
                'call-id': sipUtils.rstring(),
                cseq: req.headers.cseq,
                'expires': '3600', 'Max-Forwards': 70
            }
        }, function (ret) {
            if (ret.status === 200) {

            } else {
                logger.info(TAG, ret);
            }
        });
    }
}
